package
{
	import flash.utils.ByteArray;
	import flash.utils.Endian;
	 
	public class IndexDataRead
	{
		private var _numVertices:uint;
		private var _data:ByteArray;
		public function IndexDataRead()
		{
		}
		public function get data():ByteArray
		{
			return _data;
		}
		public function get numVertices():uint
		{
			return _numVertices;
		}
		public function read( val:ByteArray ):void
		{
			val.endian = Endian.LITTLE_ENDIAN;
			var format:int = val.readByte();
			if( format == 1 )
			{
				trace("[IndexDataRead 数据正确]");
				this._numVertices = val.readInt();
				this._data = new ByteArray();
				this._data.endian = Endian.LITTLE_ENDIAN;
				val.readBytes( this._data );
			}
			else
			{
				throw new Error("IndexDataRead::数据操作失败，数据格式不正确！");
			}
		}
	}
}